<template>
  <div id="app">
    <router-view />
    <van-tabbar v-show="!$route.meta.hidetabbar" v-model="active" active-color="#ee0a24" route>
      <van-tabbar-item :to="{name:'home'}">
        <template #icon="props">
          <img :src="props.active ? tabbaricons.homeactive : tabbaricons.homeinactive" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item :to="{name:'category'}">
        <template #icon="props">
          <img :src="props.active ? tabbaricons.categoryactive : tabbaricons.categoryinactive" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item :to="{name:'cart'}">
        <template #icon="props">
          <img :src="props.active ? tabbaricons.cartactive : tabbaricons.cartinactive" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item :to="{name:'mine'}">
        <template #icon="props">
          <img :src="props.active ? tabbaricons.mineactive : tabbaricons.mineinactive" />
        </template>
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data() {
    return {
      active: 0,
      tabbaricons:{
          homeactive:require("@/assets/img/tabbar/home-active.png"),
          homeinactive:require("@/assets/img/tabbar/home.png"),
          categoryactive:require("@/assets/img/tabbar/category-active.png"),
          categoryinactive:require("@/assets/img/tabbar/category.png"),
          cartactive:require("@/assets/img/tabbar/cart-active.png"),
          cartinactive:require("@/assets/img/tabbar/cart.png"),
          mineactive:require("@/assets/img/tabbar/mine-active.png"),
          mineinactive:require("@/assets/img/tabbar/mine.png"),
        }
    }
  },
}
</script>

<style lang="less">
.van-tabbar{
  .van-tabbar-item{
    .van-tabbar-item__icon{
      img{
        height: 50px;
      }
    }
  }
}
</style>
